<!DOCTYPE html>
<html lang="en">
<!--<base href="//hype.oss-cn-beijing.aliyuncs.com/HZY/h_project/jinrong-vue/">-->
{#<base href="//zaoqi.oss-cn-beijing.aliyuncs.com/finance_c2c/c2cshare/">#}
{#<base href="https://oss.kalaibao.com/finance_c2c/c2cshare/">#}
<head>
    <meta charset="UTF-8">
    <meta name="format-detection" content="telephone=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,minimal-ui">
    <title></title>
    <link href="https://cdn.bootcss.com/mui/3.7.1/css/mui.min.css" rel="stylesheet">
    <link rel="stylesheet" href="//cdn.midoci.com/HZY/admin/css/clearStyleApp.css">
    <link rel="stylesheet" href="//zaoqi.oss-cn-beijing.aliyuncs.com/finance_c2c/c2cshare/css/style.css">
    <script src="//cdn.midoci.com/HZY/admin/js/remSrv.js"></script>
    <style>
        body {
            margin: 0 auto;
        }
    </style>

</head>
<body>
{% if shared == 'true' %}
    <div class="container" style="padding: 0 0 2% 0; background-color: #3f4b9d !important;">
{% else %}
    <div class="container" style="padding: 0 0 2% 0; background-color: #00255d !important;">
{% endif %}
{% for i in channel_img_queryset %}
    {% if shared == 'true' %}
        <img src="{{ i.shared_img }}" alt="">
    {% else %}
        {% if forloop.first %}
            <a href="{% url 'user_operation:operation_more' %}"><img src="{{ i.img }}"></a>
        {% else %}
            <img src="{{ i.img }}" alt="">
        {% endif %}
    {% endif %}
{% endfor %}

<div class="noShare" style="display: block">
    <div class="mask-con">
        <img class="qr-img2" src="{{ path }}" alt="">
        <img class="texttip2" src="//zaoqi.oss-cn-beijing.aliyuncs.com/finance_c2c/c2cshare/images/share-text-tip2.png"
             alt="">
    </div>
</div>

</div>
</body>
<script src="https://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script>
    var urls = getUrlRequest();
    {#    if (urls.show == 'true') {#}
    {#        document.getElementsByClassName("noShare")[0].style.display = 'block';#}
    {#    } else {#}
    {#        document.getElementsByClassName("isShare")[0].style.display = 'block';#}
    {#    }#}
    {#    function showShare() {#}
    {#        document.getElementsByClassName("shareMask")[0].style.display = 'block';#}
    {#    }#}
    {#    function showQrMask() {#}
    {#        document.getElementsByClassName("qrMask")[0].style.display = 'block';#}
    {#    }#}
    {#    function hideShare() {#}
    {#        document.getElementsByClassName("mask")[0].style.display = 'none';#}
    {#        document.getElementsByClassName("mask")[1].style.display = 'none';#}
    {#    }#}
    {#    //获取url里的参数#}
    function getUrlRequest() {
        var test_url = window.location.href;
        //alert(test_url)
        var url = location.search; //获取url中"?"符后的字串
        //alert(url)
        theRequest = [];
        if (url.indexOf("?") != -1) {
            var str = url.substr(1);
            if (str.indexOf("&") != -1) {
                strs = str.split("&");
                for (var i = 0; i < strs.length; i++) {
                    //alert(strs[i].split("=")[1]);
                    //alert(encodeURI(encodeURI(strs[i].split("=")[1])));
                    theRequest.push(strs[i].split("=")[1]);
                    theRequest[strs[i].split("=")[0]] = strs[i].split("=")[1];
                }
            } else {
                var key = str.substring(0, str.indexOf("="));
                var value = str.substr(str.indexOf("=") + 1);
                //alert(value)
                //alert("value");
                theRequest[key] = decodeURI(value);
                //alert(theRequest[key]+"kye")
            }
        }
        //theRequest = theRequest[key];
        //console.log(theRequest);
        return theRequest;
    }

    // 分享 start
    $(document).ready(function () {

        var url = window.location.href;
        $.ajax({
            type: 'GET',
            url: 'https://c2c.kalaibao.com/mp/share',
            data: {"url": url},
            success: function (data) {
                var appid = data.appid;
                var timestamp = data.timestamps;
                var nonceStr = data.nonceStr;
                var signature = data.signatures;
                wx_share(appid, timestamp, nonceStr, signature)
            },
            error: function (request) {
                console.log("Connection error");
            }
        });
    });


    function wx_share(appid, timestamp, nonceStr, signature) {
        //分享
        var link = "https://c2c.kalaibao.com/mp/c2c_share?shared=true&sid=" + urls.sid;
        wx.config({
            debug: true,
            appId: appid,
            timestamp: timestamp,
            nonceStr: nonceStr,
            signature: signature,
            jsApiList: [
                'checkJsApi',
                'onMenuShareTimeline',
                'onMenuShareAppMessage',
                'onMenuShareQQ',
                'onMenuShareWeibo']
        });

        var shareAppData = {
            title: '{{sales_obj.name}} 邀请您成为“零号金融”合伙人。',
            desc: '0成本加盟，超过10家银行金融产品。人人分享、锁定团队。年薪百万不是梦',
            link: link,  // 必须跟当前域名保持一致
            imgUrl: 'https://zaoqi.oss-cn-beijing.aliyuncs.com/finance_c2c/c2cshare/images/share.jpg',
            trigger: function () {
            }
        };


        var shareTimelineData = {
            title: '{{sales_obj.name}} 邀请您成为“零号金融”合伙人。',
            desc: '0成本加盟，超过10家银行金融产品。人人分享、锁定团队。年薪百万不是梦',
            link: link,  // 必须跟当前域名保持一致
            imgUrl: 'https://zaoqi.oss-cn-beijing.aliyuncs.com/finance_c2c/c2cshare/images/share.jpg',
            trigger: function () {
            }
        };

        wx.ready(function () {
            wx.onMenuShareAppMessage(shareAppData); // 分享跟朋友
            wx.onMenuShareTimeline(shareTimelineData); //分享到朋友圈
        });
    }
</script>
</html>
